package com.bxmdm.ragdemo.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
//import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ChatController
 * @Description
 * @Author li
 * @Time 2025/4/24 16:46
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/ai/simple")
@Tag(name = "简单对话 demo")
public class ChatController {

    @Autowired
    private OllamaChatModel ollamaChatClient;

    @Operation(summary = "普通问答")
    @GetMapping("/chat")
    public ResponseEntity chat(@RequestParam String message) {
        return ResponseEntity.ok(ollamaChatClient.call(message));
    }

}
